# AT-SPI Example Makefile
CC = gcc
CFLAGS = -Wall -Wextra -pedantic -std=c11 -O2 -g
LDFLAGS = 
TARGET = atspi-demo
SRC = main.c
OBJ = $(SRC:.c=.o)
PKG_CONFIG_LIBS = atspi-2 glib-2.0 gobject-2.0

# 获取pkg-config设置
CFLAGS += $(shell pkg-config --cflags $(PKG_CONFIG_LIBS))
LDFLAGS += $(shell pkg-config --libs $(PKG_CONFIG_LIBS))

# 主目标
all: $(TARGET)

$(TARGET): $(OBJ)
	$(CC) $^ -o $@ $(LDFLAGS)

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f $(OBJ) $(TARGET)

run: $(TARGET)
	./$(TARGET)

# 安装/卸载
PREFIX = /usr/local
install: $(TARGET)
	install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET)

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/$(TARGET)

.PHONY: all clean run install uninstall